class OrderBeautyItemsController < ApplicationController
   def new
  	@order_beauty_item = OrderBeautyItem.new
    @beauty_items = BeautyItem.all
  end

  def create
  	@order_beauty_item = OrderBeautyItem.new post_params
    if @order_beauty_item.save
       redirect_to order_beauty_path(:id =>@order_beauty_item.order_beauty.id)
    else
      render :action => 'new'
    end
  end

  def destroy
    @order_beauty_item = OrderBeautyItem.find params[:id]
    @order_beauty_item.destroy
    redirect_to order_beauty_path(:id =>@order_beauty_item.order_beauty.id)
  end

  def post_params
    params.require(:order_beauty_item).permit(*%w(order_beauty_id beauty_item_id qty))
  end
end
